<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Copyright © 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>Other poly_int arithmetic (GNU Compiler Collection (GCC) Internals)</title>

<meta name="description" content="Other poly_int arithmetic (GNU Compiler Collection (GCC) Internals)">
<meta name="keywords" content="Other poly_int arithmetic (GNU Compiler Collection (GCC) Internals)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Option-Index.html" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Arithmetic-on-poly_005fints.html" rel="up" title="Arithmetic on poly_ints">
<link href="Division-of-poly_005fints.html" rel="prev" title="Division of poly_ints">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
-->
</style>


</head>

<body lang="en">
<div class="subsection-level-extent" id="Other-poly_005fint-arithmetic">
<div class="nav-panel">
<p>
Previous: <a href="Division-of-poly_005fints.html" accesskey="p" rel="prev">Division of <code class="code">poly_int</code>s</a>, Up: <a href="Arithmetic-on-poly_005fints.html" accesskey="u" rel="up">Arithmetic on <code class="code">poly_int</code>s</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsection" id="Other-poly_005fint-arithmetic-1"><span>10.4.4 Other <code class="code">poly_int</code> arithmetic<a class="copiable-link" href="#Other-poly_005fint-arithmetic-1"> &para;</a></span></h4>

<p>There are tentative routines for other operations besides division:
</p>
<dl class="table">
<dt>&lsquo;<samp class="samp">can_ior_p (<var class="var">a</var>, <var class="var">b</var>, &amp;<var class="var">result</var>)</samp>&rsquo;</dt>
<dd><p>Return true if we can calculate &lsquo;<samp class="samp"><var class="var">a</var> | <var class="var">b</var></samp>&rsquo; at compile time,
storing the result in <var class="var">result</var> if so.
</p></dd>
</dl>

<p>Also, ANDs with a value &lsquo;<samp class="samp">(1 &lt;&lt; <var class="var">y</var>) - 1</samp>&rsquo; or its inverse can be
treated as alignment operations.  See <a class="xref" href="Alignment-of-poly_005fints.html">Alignment of <code class="code">poly_int</code>s</a>.
</p>
<p>In addition, the following miscellaneous routines are available:
</p>
<dl class="table">
<dt>&lsquo;<samp class="samp">coeff_gcd (<var class="var">a</var>)</samp>&rsquo;</dt>
<dd><p>Return the greatest common divisor of all nonzero coefficients in
<var class="var">a</var>, or zero if <var class="var">a</var> is known to be zero.
</p>
</dd>
<dt>&lsquo;<samp class="samp">common_multiple (<var class="var">a</var>, <var class="var">b</var>)</samp>&rsquo;</dt>
<dd><p>Return a value that is a multiple of both <var class="var">a</var> and <var class="var">b</var>, where
one value is a <code class="code">poly_int</code> and the other is a scalar.  The result
will be the least common multiple for some indeterminate values but
not necessarily for all.
</p>
</dd>
<dt>&lsquo;<samp class="samp">force_common_multiple (<var class="var">a</var>, <var class="var">b</var>)</samp>&rsquo;</dt>
<dd><p>Return a value that is a multiple of both <code class="code">poly_int</code> <var class="var">a</var> and
<code class="code">poly_int</code> <var class="var">b</var>, asserting that such a value exists.  The
result will be the least common multiple for some indeterminate values
but not necessarily for all.
</p>
<p>When using this routine, please add a comment explaining why the
assertion is known to hold.
</p></dd>
</dl>

<p>Please add any other operations that you find to be useful.
</p>
</div>



</body>
</html>
